package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * @author
 */
@Mapper
public interface SetmealDishMapper {



    void insertBatch(List<SetmealDish> setmealDishes);

    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getBySetmealId(Long id);

    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);


    @Select("select count(*) from dish d,setmeal_dish s where d.id=s.dish_id and d.status=1")
    Long selectByIdStatus(Long id);

    @Select("select  count(s.dish_id) from setmeal_dish s left join dish d  on  s.dish_id=d.id  where  s.dish_id =#{id}")
    Long getByDishId(Long id);
}
